<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>编辑用户</title>
	<link rel="stylesheet" href="/admin/src/css/layui.css">
	<style>
		.mr10{
			display: inline-block;
		}
		.layui-form-label{
			min-width: 120px;
		}
		.layui-form-item .layui-input-inline{
			width:320px;
		}
	</style>
</head>

<body >
	<form class="layui-form " style="margin:20px auto;">
		<div class="layui-form-item">
			<label class="layui-form-label">用户id</label>
			<div class="layui-input-inline">
				<input type="text" name="id" id="id" value="{$info['id']}" disabled="disabled" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">用户账户</label>
			<div class="layui-input-inline">
				<input type="text" name="account" id="account" value="{$info['account']}" disabled="disabled" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">用户昵称</label>
			<div class="layui-input-inline">
				<input type="text" name="nickname" id="nickname" value="{$info['nickname']}"  disabled="disabled" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">用户头像</label>
			<div class="layui-input-inline">
				<img style="width:50px;height: auto" src="{$info['avatar']}">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">是否禁用</label>
			<div class="layui-input-block">
				<input type="radio" name="status" value="1" title="否" {$info['status'] == 1 ? 'checked' : ''}>
				<input type="radio" name="status" value="0" title="是" {$info['status'] == 0 ? 'checked' : ''}>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">登录密码</label>
			<div class="layui-input-inline">
				<input type="text" name="log_pwd" id="log_pwd" value="" placeholder="请输入登录密码" autocomplete="off" class="layui-input">
			</div>
			<div class="layui-form-mid layui-word-aux">留空默认不修改</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">支付密码</label>
			<div class="layui-input-inline">
				<input type="text" name="pay_pwd" id="pay_pwd" value="" placeholder="请输入支付密码" autocomplete="off" class="layui-input">
			</div>
			<div class="layui-form-mid layui-word-aux">留空默认不修改，只能填写6位数字</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">备注</label>
			<div class="layui-input-inline">
				<input type="text" name="mark" id="mark" value="{$info['mark']}"  placeholder="请输入备注" autocomplete="off" class="layui-input">
			</div>
		</div>
	  <div class="layui-form-item">
	    <div class="layui-input-block">
	      <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
	    </div>
	  </div>
	</form>
	<script src="/admin/src/layui.js" ></script>
<script>

	var infoStatus = '{$infoStatus}'
    layui.use(['form','jquery','upload'], function(){
      var form = layui.form ,
		  layer = layui.layer,
          upload = layui.upload,
		  $= layui.jquery;
      if(infoStatus == 0){
		  layer.msg('获取不到对应的信息',{time:1000},function(){
		  		window.parent.frames.location.href="/admin/user/index"
		  })
	  }

      //监听表单提交
      form.on('submit(formDemo)', function(data){
		var postData = data.field;
		$.ajax({
			url: '/admin/user/update/data',
			type: 'POST',
			data:postData,
			success : function (backData) {
			  if(backData['status'] == 200){
				  layer.msg(backData.message,{time:1200},function(){
					  window.parent.frames.location.href="/admin/user/index"
				  })
			  }else{
				  layer.msg(backData.message);
			  }
			}
		})
        return false;
      });
    });

</script>
</body>
</html>
